<!-- 底部的vue组件 -->
<template>
   <footer class="footer_guide" v-show="$route.meta.showFooter">
    <a href="javascript:;" class="guide_item" :class="{on: $route.path === '/miste'}" @click="goto('/miste')">
      <span class="item_icon">
        <i class="iconfont icon-waimai"></i>
      </span>
      <span>外卖</span>
    </a>
    <a href="javascript:;" class="guide_item" :class="{on: $route.path === '/search'}" @click="goto('/search')">
      <span class="item_icon">
        <i class="iconfont icon-search"></i>
      </span>
      <span>搜索</span>
    </a>
    <a href="javascript:;" class="guide_item" :class="{on: $route.path === '/order'}" @click="goto('/order')">
      <span class="item_icon">
        <i class="iconfont icon-dingdan"></i>
      </span>
      <span>订单</span>
    </a>
    <a href="javascript:;" class="guide_item" :class="{on: $route.path === '/profile'}" @click="goto('/profile')">
      <span class="item_icon">
        <i class="iconfont icon-geren"></i>
      </span>
      <span>我的</span>
    </a>
  </footer>
</template>

<script>
export default {
  data () {
    return {
    };
  },

  components: {},

  computed: {},

  mounted() {},

  methods: {
    // 跳转到对应的路径
    goto(pathStr) {
      // 这里为什么使用了 replace 而不是 push 方法呢 ? 
      // push 方法是在栈上添加一个路由, 点击返回, 还能够返回当前的路由
      // replace 方法是直接替换当前的路由对象, 没有新添加一个路由, 点击返回不能返回到上一个路由中
      // 而目前所做的是 app 程序, 因为当前是主界面, 所以返回应该直接退出当前应用, 所以这里使用 replace 比较合适一些
      this.$router.replace(pathStr)
    }
  }
}

</script>

<style lang="stylus" rel="stylesheet/stylus">
  @import "../../common/stylus/mixins.styl"
  .footer_guide  //footer
    top-border-1px(#e4e4e4)
    position fixed
    z-index 100
    left 0
    right 0
    bottom 0
    background-color #fff
    width 100%
    height 50px
    display flex
    .guide_item
      display flex
      flex 1
      text-align center
      flex-direction column
      align-items center
      margin 5px
      color #999999
      &.on
        color #02a774
      span
        font-size 12px
        margin-top 2px
        margin-bottom 2px
        .iconfont
          font-size 22px
</style>